package com.easylinkin.sm.controller;

import com.easylinkin.sm.constant.LogConstant.Module;
import com.easylinkin.sm.entity.Dict;
import com.easylinkin.sm.service.DictService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.morn.boot.data.CrudControllerSupport;
import site.morn.log.OperateGroup;
import site.morn.rest.RestBuilders;
import site.morn.rest.RestMessage;

/**
 * 数据字典
 *
 * @author wujie
 * @since 0.1.1,  2019/08/19
 */
@Api(tags = "数据字典管理")
@OperateGroup(value = "dict", args = Module.DICT)
@RestController
@RequestMapping("/dict")
public class DictController extends
    CrudControllerSupport<Dict, Long, DictService> {

  @ApiOperation("获取数据字典类型的树状")
  @GetMapping(value = "getTreeData")
  public RestMessage getTreeData(Long parentId) {
    List<Dict> models = this.service().getTreeData(parentId);
    return RestBuilders.successMessage(models);
  }

}
